<!--代码框-->
<script setup>
import {toRefs} from "vue";
import {useStore} from "vuex";
import {Codemirror} from "vue-codemirror";
import {EditorState} from "@codemirror/state";
import ClickCopy from "@/components/common/click-copy.vue";

const props = defineProps({
  data: {type: String, required: true},
})
const store = useStore();
const {data} = toRefs(props)

let view;

// 文本框准备好了
const handleReady = (payload) => {
  view = payload.view;
  // console.log(view)
}

</script>

<template>
  <div class="nga-quote">
    <click-copy :text="data">
      <el-button size="small" type="primary">复制代码</el-button>
    </click-copy>
    <codemirror v-model="data" :extensions="[EditorState.readOnly.of(true)]" aria-readonly="true" @ready="handleReady"/>
  </div>
</template>

<style scoped>

</style>